//
//  HttpRequest.h
//  封装
//
//  Created by boleguigu_dev1 on 16/4/26.
//  Copyright © 2016年 boleguigu_dev1. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "Constant.h"

typedef void (^DidFinishBlock)(NSDictionary *backdict);
typedef void (^DidFailedBlock)();

@interface HttpRequest : NSObject

@property (strong, nonatomic) NSMutableData *resultData;
@property (strong, nonatomic) DidFinishBlock didFinishBlock;
@property (strong, nonatomic) DidFailedBlock didFailedBlock;

//post方法，没有的参数传nil
+ (void)postRequestWithURL:(NSString *)url
                 paramters:(NSDictionary  *)paramters
              requireLogin:(TokenState)requireLogin
            didFinishBlock:(DidFinishBlock)didFinishBlock
            didFailedBlock:(DidFailedBlock)didFailedBlock;

//delgete方法，没有的参数传nil
+ (void)deleteRequestWithURL:(NSString *)url
                   paramters:(NSDictionary  *)paramters
                requireLogin:(TokenState)requireLogin
              didFinishBlock:(DidFinishBlock)didFinishBlock
              didFailedBlock:(DidFailedBlock)didFailedBlock;

//get方法，没有的参数传nil
+ (void)getRequestWithURL:(NSString *)url
                paramters:(NSString *)paramters
             requireLogin:(TokenState)requireLogin
           didFinishBlock:(DidFinishBlock)didFinishBlock
          didFailedBlock :(DidFailedBlock)didFailedBlock;

//patch方法，没有的参数传nil
+ (void)patchRequestWithURL:(NSString *)url
                  paramters:(NSDictionary  *)paramters
               requireLogin:(TokenState)requireLogin
             didFinishBlock:(DidFinishBlock)didFinishBlock
             didFailedBlock:(DidFailedBlock)didFailedBlock;

//put方法，没有的参数传nil
+ (void)putRequestWithURL:(NSString *)url
                paramters:(NSDictionary  *)paramters
             requireLogin:(TokenState)requireLogin
           didFinishBlock:(DidFinishBlock)didFinishBlock
           didFailedBlock:(DidFailedBlock)didFailedBlock;

//上传图，没有的参数传nil
+(void) uploadImageWithURL:(NSString *) url
                    images:(NSArray *) images
                 paramters:(NSDictionary *) paramters
              requireLogin:(TokenState)requireLogin
            didFinishBlock:(DidFinishBlock)didFinishBlock
            didFailedBlock:(DidFailedBlock)didFailedLoginBlock;

//上传音频
+(void)uploadRecordWithURL:(NSString *)url
                    record:(NSData *)record
                 paramters:(NSDictionary *)paramters
              requireLogin:(TokenState)requireLogin
            didFinishBlock:(DidFinishBlock)didFinishBlock
            didFailedBlock:(DidFailedBlock)didFailedBlock;

@end
